﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using NTTDATA.BEENChina.ResultCertification.Client.Entry.Model;
using NTTDATA.BEENChina.ResultCertification.Client.Entry.ServiceEntry;

namespace NTTDATA.BEENChina.ResultCertification.Client.Entry.Logic
{
   public class JobListHelper
    {


       public List<string> GetVerfityJobDate()
       {
           List<string> orderDates = null;
           using (ServiceEntryClient  entryClient = new ServiceEntryClient() )
           {
               orderDates = entryClient.GetDistinctOrderReceiveDates();
           }

           return orderDates;
       }

       public NameValueCollection GetCategoryType()
       {
           var collection = new NameValueCollection
                                                {
                                                    {"日期", "0"},
                                                    {"数值", "1"},
                                                    {"电话", "2"},
                                                    {"文字列", "3"},
                                                    {"姓名", "4"},
                                                    {"住所", "5"}
                                                };

            //日期,数值,电话,文字列,姓名,住所

           return collection ;
           
       }

       public List<VerfityJobListItem> GetJobList(string orderDate, string categoryType)
       {
           List<VerfityJobListItem>  jobList = null;

           using (ServiceEntryClient entryClient = new ServiceEntryClient())
           {
               jobList = entryClient.GetJobList(orderDate, categoryType);
           }

           return jobList;
       }

       
       public VerfityJobItem DownLoadJob(string userId, string verfityId,string categoryId,string orderDate)
       {
           
           VerfityJobItem verfityJobItem ;
           try
           {
               using (ServiceEntryClient entryClient = new ServiceEntryClient())
               {
                   verfityJobItem = entryClient.DownLoadJob(userId, verfityId, categoryId, orderDate);
               }

               if (verfityJobItem != null)
               {
                   ImageHelper.SaveImage(verfityJobItem);
               }
           }
           catch (Exception ex)
           {
               
               throw ex;
           }


           return verfityJobItem;
           
       }

       public int UpLoadJob(string userId, VerfityJobItem verfityJobItem)
       {
           int rows = 0;
           using (ServiceEntryClient entryClient = new ServiceEntryClient())
           {
               rows = entryClient.UpLoadJob(userId, verfityJobItem);
           }

           return rows;

       }

      

       public IList<MissKindList> getMissKindList()
       {
           return null;
           //return WCFHelper.GetInstance().getMissKindList();
       }

       public int SetUserListUnLock(string UserID, string Note)
       {
           try
           {
               return 0;
               //return WCFHelper.GetInstance().SetUserListUnLock(UserID, Note);
           }
           catch
           {
               return -1;
           }
           
       }
    }
}
